package test

import cn.hutool.log.Log
import com.gitee.ixtf.cqrs.verticle.EventSourcedEntity
import com.github.benmanes.caffeine.cache.Caffeine
import java.util.concurrent.TimeUnit
import kotlin.reflect.jvm.javaMethod
import shoppingcart.application.ShoppingCartEntity

private val log by lazy { Log.get() }

private val CACHE =
    Caffeine.newBuilder()
        .maximumSize(100_000)
        .expireAfterAccess(1, TimeUnit.HOURS)
        .evictionListener<String, EventSourcedEntity<*, *>> { k, v, cause -> v?.invalidate() }
        .buildAsync<String, EventSourcedEntity<*, *>>()

fun main() {
  val f = ShoppingCartEntity::addItem
  val method = f.javaMethod
  println(method?.declaringClass)
}
